package com.adhoc;

import android.util.Log;

public class Wireless {
	public static void enable(String mode, int channel, String essid, String ip, String mask)
	{

		SystemCommands.executeAsRoot("insmod /system/lib/hw/wlan/ar6000.ko");

		try {
			Thread.sleep(3000);
		} catch (InterruptedException e) {
			Log.e("WLAN0", "Problem sleeping the thread");
		}

		SystemCommands.executeAsRoot("iwconfig wlan0 mode " + mode);
		SystemCommands.executeAsRoot("iwconfig wlan0 channel " + channel);
		SystemCommands.executeAsRoot("iwconfig wlan0 essid " + essid);
		SystemCommands.executeAsRoot("ifconfig wlan0 " + ip + " netmask " + mask);
		SystemCommands.executeAsRoot("ifconfig wlan0 up");

	}

	public static void disable()
	{

		SystemCommands.executeAsRoot("ifconfig wlan0 down");
		SystemCommands.executeAsRoot("rmmod ar6000");

	}
}
